package com.hongdee.base.imp.dao.impl;

import com.fasterxml.jackson.databind.deser.Deserializers;
import com.hongdee.base.basedao.impl.BaseDaoImpl;
import com.hongdee.base.imp.dao.IExcelSchemeDao;
import com.hongdee.base.imp.entity.TExcelScheme;
import com.hongdee.base.imp.entity.TExcelSchemeExp;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * 名  称:ExcelSchemeDaoImpl
 * 类  型: class
 * 描  述: 用一句话描述类的作用
 * 路  径:com.hongdee.base.imp.dao.impl
 * 作  者:My
 * 日  期:2017/2/15 11:46
 */
@Service
public class ExcelSchemeDaoImpl extends BaseDaoImpl implements IExcelSchemeDao {

    /**
     * 根据ID获得导入方案信息
     * @param id
     * @return
     * @throws Exception
     */
    @Override
    public TExcelScheme getExcelSchemeById(String id) throws Exception {
        return (TExcelScheme) this.getHibernateDao().findEntity(TExcelScheme.class,id);
    }

    /**
     * 获得上传的扩展信息
     * @param entityId
     * @param brand
     * @return
     * @throws Exception
     */
    @Override
    public TExcelSchemeExp getExcelSchemeExpByBrandAndEntity(String entityId,String brand) throws Exception {
        String hql="from TExcelSchemeExp where brand=:brand and dataEntityId=:dataEntityId";
        Map map=new HashMap();
        map.put("dataEntityId",entityId);
        map.put("brand",brand);
        return (TExcelSchemeExp) this.getHibernateDao().findEntityByHqlWithParams(hql,map);
    }
}
